<template>
  <main class="user">
    <section class="user-con">
      <div class="con-list">
        <ul>
          <li :class="{ active: showIdx === 0 }" @click="toUpdateDate(0)">
            我的信息
          </li>
          <li :class="{ active: showIdx === 1 }" @click="toUpdatePwd(1)">
            修改密码
          </li>
          <li :class="{ active: showIdx === 2 }" @click="toUpdatePict(2)">
            我的头像
          </li>
          <li :class="{ active: showIdx === 3 }" @click="toUpdateSite(3)">
            收获地址
          </li>
        </ul>
      </div>
      <router-view></router-view>
    </section>
  </main>
</template>

<script>
export default {
  name: "User",
  data() {
    return {
      showIdx: 0,
    };
  },
  methods: {
    toUpdateDate(idx) {
      this.showIdx = idx;
      this.$router.push({
        path: "/user/updateDate",
      });
    },
    toUpdatePwd(idx) {
      this.showIdx = idx;
      this.$router.push({
        path: "/user/updatePwd",
      });
    },
    toUpdatePict(idx) {
      this.showIdx = idx;
      this.$router.push({
        path: "/user/updatePict",
      });
    },
    toUpdateSite(idx) {
      this.showIdx = idx;
      this.$router.push({
        path: "/user/UpdateSite",
      });
    },
  },
};
</script>

<style lang="stylus" scoped>
.user {
  width: 100%;
  min-width: 800px;
  margin-top: 60px;
  padding: 40px 0;
  background-color: #f8f8f8;

  .user-con {
    width: 80%;
    min-width: 800px;
    min-height: 400px;
    margin: 0 auto;
    display: flex;
    border: 1px solid #ccc;
    color: #999;
    font-size: 14px;

    .con-list {
      width: 20%;

      ul {
        width: 120px;
        height: 100%;
        padding-top: 10px;
        box-sizing: border-box;
        border-right: 1px solid #ccc;
        background-color: #fff;

        li {
          padding-left: 28%;
          line-height: 30px;
          cursor: pointer;
        }
      }
    }
  }

  .active {
    background-color: #fe4d1b;
    color: #fff;
  }
}
</style>